//
//  HCache.m
//  G&C
//
//  Created by dlios on 15/9/26.
//  Copyright (c) 2015年 韩. All rights reserved.
//

#import "HCache.h"

@implementation HCache

//  存
+(void)saveCacheWithPassword:(NSString *)password Type:(NSInteger)type Object:(NSDictionary *)object
{
    // 轻量级存储(单例):password网络请求的链接,type是key的组成部分,没有特殊含义,object就是存的值
    NSUserDefaults *data = [NSUserDefaults standardUserDefaults];
    NSString *key = [NSString stringWithFormat:@"zy--%@--%ld",password,type];
    [data setObject:object forKey:key];
    // 同步存储
    [data synchronize];
}
// 取
+(NSDictionary *)getCacheWithPassword:(NSString *)password Type:(NSInteger)type
{
    NSUserDefaults *data = [NSUserDefaults standardUserDefaults];
    
    NSString *key = [NSString stringWithFormat:@"zy--%@--%ld",password,type];
    
    NSDictionary *cacheDic = [data objectForKey:key];
    return cacheDic;

}
// 更新
+(void)removeCacheWithPassword:(NSString *)password Type:(NSInteger)type
{
    NSUserDefaults *data = [NSUserDefaults standardUserDefaults];
    NSString *key = [NSString stringWithFormat:@"zy--%@--%ld",password,type];
    [data removeObjectForKey:key];
}



@end
